<?php
class Activity extends BlockInstance {
	public $CI;
	
	public function __construct()
	{
		$this->CI =& get_instance();
	}
	
	/**
	 * Note: $activity is already set by the time this block is rendered.
	 */
	public function __call($m, $a)
	{
		global $BBX;
		$bricabox = $BBX['bricabox'];
		if (preg_match('/[a-z]+_([a-z]+)/', $m, $matches))
		{
			if ($matches[1] == 'content')
			{
				$content = $a[1];
				$data 	 = array(
					'block_instance' => $a[0],
					'bricabox'		 => $bricabox,
					'content_id'	 => $content->id,
					'scope_arr'		 => array('content', 'bricabox')
				);
				$this->CI->load->view('blocks/activity/block', $data);
			}
			elseif ($matches[1] == 'homepage')
			{
				$data = array(
					'block_instance' => $a[0],
					'bricabox'		 => $bricabox,
					'scope_arr'		 => array('bricabox')
				);
				$this->CI->load->view('blocks/activity/block', $data);
			}
		}
	}
}
?>